<!DOCTYPE html>
<html lang="zh" xmlns:v-on="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>新增文档 - 光年(Light Year Admin)后台管理系统模板</title>
<link rel="icon" href="images/favicon.ico" type="image/ico">
<meta name="keywords" content="LightYear,光年,后台模板,后台管理系统,光年HTML模板">
<meta name="description" content="LightYear是一个基于Bootstrap v3.3.7的后台管理系统的HTML模板。">
<meta name="author" content="yinqi">
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/materialdesignicons.min.css" rel="stylesheet">
<!--标签插件-->
<link rel="stylesheet" href="js/jquery-tags-input/jquery.tagsinput.min.css">
<link href="css/style.min.css" rel="stylesheet">
  <script src="js/head.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
  <script src="js/login/login.js"></script>
  <script src="js/http.js"></script>
</head>

<body>
<div class="lyear-layout-web" id="vue">
  <div class="lyear-layout-container">
    <!--左侧导航-->
    <aside class="lyear-layout-sidebar">

      <!-- logo -->
      <div id="logo" class="sidebar-header">
        <a href="index.html"><img src="images/logo-sidebar.png" title="LightYear" alt="LightYear" /></a>
      </div>
      <div class="lyear-layout-sidebar-scroll">

        <nav class="sidebar-main">
          <ul class="nav nav-drawer">
            <script src="js/leftNav.js"></script>
          </ul>
        </nav>

        <div class="sidebar-footer">
          <p class="copyright">Copyright &copy; 2019. <a target="_blank" href="http://lyear.itshubao.com">IT书包</a> All rights reserved.</p>
        </div>
      </div>

    </aside>
    <!--End 左侧导航-->



    <!--页面主要内容-->
    <main class="lyear-layout-content">

      <div class="container-fluid">

        <div class="row">
          <div class="col-lg-12">
            <div class="card">
              <div class="card-body">

                <div  class="row">
                  <div class="form-group col-md-12">
                    <label for="userName">用户名</label>
                    <input type="text" class="form-control" id="userName" name="title" value="" placeholder="请输入用户名" v-model="username"/>
                  </div>
                  <div class="form-group col-md-12">
                    <label for="password">密码</label>
                    <input type="text" class="form-control" id="password" name="title" value="" placeholder="请输入密码" v-model="password"/>
                  </div>
                  <div class="form-group col-md-12">
                    <label for="phone">手机号</label>
                    <input type="text" class="form-control" id="phone" name="seo_keywords" value="" placeholder="请输入手机号码" v-model="telephone"/>
                  </div>
                  <div class="form-group col-md-12">
                    <label for="e-mail">邮箱</label>
                    <input type="text" class="form-control" id="e-mail" name="seo_keywords" value="" placeholder="请输入邮箱" v-model="email"/>
                  </div>
                  <div class="form-group col-md-12">
                    <label for="nickName">呢称</label>
                    <input type="text" class="form-control" id="nickName" name="seo_keywords" value="" placeholder="请输入呢称" v-model="nickname"/>
                  </div>
                  <div style="padding-top: 20px;padding-left: 15px;padding-bottom: 20px">
                      <label >用户类型</label>
                      <input type="radio" id="one" value="1"
                             v-model="type">
                      <label for="one" class="text-success">普通用户</label>
                      <input type="radio" id="two" value="99"
                             v-model="type">
                      <label for="two" class="text-danger">管理员</label>
                  </div>
                  <div class="col-md-12">
                    <button type="button"  class="btn btn-primary" v-on:click="insertUser">确 定</button>
                    <button type="button" class="btn btn-default" onclick="javascript:location.href='userList.html'">返 回</button>
                  </div>


              </div>
            </div>
          </div>

        </div>

      </div>
      </div>
    </main>
    <!--End 页面主要内容-->
  </div>
</div>

<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/perfect-scrollbar.min.js"></script>
<!--标签插件-->
<script src="js/jquery-tags-input/jquery.tagsinput.min.js"></script>
<script type="text/javascript" src="js/main.min.js"></script>
</body>
</html>
<script type="text/javascript">
    let vm=new Vue({
        el:'#vue',
        data:{
            username: "",
            password: "",
            telephone: "",
            email: "",
            nickname: "",
            type: "",
        },
        methods:{
            insertUser:function () {
                username = vm.username;
                password = vm.password;
                telephone = vm.telephone;
                email = vm.email;
                nickname = vm.nickname;
                type = vm.type;
                $.ajax({
                    type: "POST",
                    url: baseUrl+"education_admin/user/insertUser",
                    data: {
                        username,
                        password,
                        telephone,
                        email,
                        nickname,
                        type,
                    },
                    success: function (resp) {
                        let result = JSON.parse(resp);
                        alert(result.message);
                    }
                })
            }
            
        }
    })
</script>